
cd "C:\Users\lenovo\Desktop\WongLiangPOBE\WongLiangStudy2\WongLiangStudy2multistate" 

*======starting from recommended comments (positive), through skip comments (ignore), ending with netizens comments (negative)===========================

use "ndf1",clear

*starting from positive, through ignore, ending with negative

msset , id(id) states(ignore negative) times (t_ignore t_negative ) covariates( male age ccp edu income poli_interest news_consumption frequent_use most_recent_use discussion internal_efficacy external_efficacy resist_west collectivism national_pride info_transparency satisfy_life satisfy_society)

mat tmat = r(transmatrix)

* display transition matrix
matlist tmat 

*             | to                              
*             | start(positive)  ignore    negtive 
*-------------+---------------------------------
*from         |                                 
*  start(pos) |         .          1          2 
*      ignore |         .          .          3 
*     negtive |         .          .          . 


* Declare data to be survival-time data
stset _stop, enter(_start) failure(_status=1)

* Parametric survival models with weibull distribution. No hazard ratio reported but coefficients. 
streg male age ccp edu income poli_interest news_consumption frequent_use most_recent_use discussion internal_efficacy external_efficacy resist_west collectivism national_pride info_transparency satisfy_life satisfy_society _trans2 _trans3, dist(weibull) nohr vce(cluster id)

* Generate survival model graph Figure 6 - Study 2
predictms , transmat(tmat) ci graph
